package com.xiaoxie.common.exception;

import com.xiaoxie.common.enums.ReturnCode;
import lombok.Data;

/**
 * @author xiaoxie
 * @create 2025-01-21 16:05
 * @since 1.0.0
 * @desc 业务异常
 */
@Data
public class BizException extends RuntimeException {
    private Integer code;

    public BizException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public BizException(Integer code, String msg, Throwable cause) {
        super(msg, cause);
        this.code = code;
    }

    public BizException(ReturnCode returnCode) {
        super(returnCode.getMessage());
        this.code = returnCode.getCode();
    }
}
